import * as vscode from 'vscode'
import * as fs from 'fs';
import * as path from 'path';
import { Words } from '../interfaces/Words'
import * as ejs from 'ejs'

// 获取web的 html
export const getHtmlForWebview = (context: vscode.ExtensionContext, words: Words) => {

    let html = fs.readFileSync(
        path.join(context.extensionPath, './src/html/words.ejs'),
        'utf-8').toString()
    html = ejs.render(html, { words });

    return html;
}